#!/bin/sh
#BK called from udev rule in /etc/udev/rules.d/52-usb_modem_puppy.rules
#120109 usb_modeswitch 1.2.1: my optus 3g modem, not creating /dev/gsmmodem. call usb_modeswitch_status to do all the work.

PARAM1=""
[ $1 ] && PARAM1="$1"

if [ "$PARAM1" = "3g" ];then #120109 3g: see 52-usb_modem_puppy.rules
 #just go to normal status script...
 echo "Mode switching was successful" > /var/log/usb_modeswitch_special_status #read by usb_modeswitch_status
 #do not use 'exec' as udev calls this script multiple times and it must complete. but,
 #usb_modeswitch_status has a lock region that prevents near-simultaneous multiple instances, but need
 #to also do a running-check here first...
 [ "`/bin/pidof usb_modeswitch_status`" = "" ] && /usr/sbin/usb_modeswitch_status &
fi
